class Student{
    public String name;
    public int age;

    Student(){
        this.name="";
        this.age=18;
    }
    Student(String name,int age){
        this.name=name;
        this.age=age;
    }
    //当我们定义了一个类的构造函数后系统将不再提供默认的构造函数
    // (也就是咱要么不用无参构造 要么就自己写一个)

    public void setStudent(String name,int age){
        this.name=name;
        this.age=age;
    }
    public void show(){
        System.out.println(name+" "+age);
    }
    //修改年龄
    public void modifyAge(int newAge){
        this.setStudent(this.name,newAge);
    }
}

public class TestStudent {
    public static void main(String[] args){
        Student stu1=new Student("小王",20);
        stu1.show();//小王 20
        Student stu2=new Student();
        stu2.show();// 18
    }

    public static void main1(String[] args) {
        Student stu1=new Student();
        stu1.show();//null 0
        stu1.setStudent("王明",15);
        stu1.show();//王明 15
        stu1.modifyAge(20);
        stu1.show();//王明 20
    }
}
